package com.star.service.impl;

import com.star.domain.Order;
import com.star.dto.ResponseData;
import com.star.mapper.OrderMapper;
import com.star.service.OrderService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author Star
 * @since 2021-04-21
 */
@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService {
    @Autowired
    private OrderMapper orderMapper;

    /**
     * 生成订单
     * @param order 订单对象
     * @return
     */
    @Override
    public ResponseData orderAdd(Order order) {
        int flog = orderMapper.insert(order);
        //插入成功
        if(flog>0){
           return ResponseData.ok();
        }else {
            return ResponseData.customerError();
        }
    }
}
